<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template.xhtml">
		<ui:define name="content">
			<script src="http://maps.google.com/maps/api/js?sensor=false"
				type="text/javascript" />
			<script type="text/javascript"
				src="../resources/javascript/mapCodeSovtivityPoint.js" />
			<f:view>
				<p:layout id="top" style="min-width:400px;min-height:600px;" fullpage="true">
					
					<p:layoutUnit position="west" resizable="true" size="230"
						minSize="40" maxSize="230" id="first">
						<!--  Side Navigation -->
						<ul id="sideNavigation">
							<li><h:outputLink value="myTasks.xhtml">
									<h:outputText value="My Tasks" />
								</h:outputLink></li>
							<li><h:outputLink value="pool.xhtml">
									<h:outputText value="Open Tasks" />
								</h:outputLink></li>
							<li><h:outputLink value="ticket.xhtml">
									<h:outputText value="Create Ticket" />
								</h:outputLink></li>
						</ul>
					</p:layoutUnit>
					
					
					<!--  Contents -->
					<p:layoutUnit position="center">
						<center>

							<h:outputLabel id="greeting" value="#{userMBean.getGreeting()}" />

						</center>
						<h1>
							<h:outputText value="Create Ticket" />
						</h1>

						<div>
							<h:form id="panel1Form">
								<h:outputLabel value="Put in your data  (click on value to change it)" />


								<p:panelGrid id="panel1" columns="2">

									<!-- Vorname -->
									<h:outputLabel for="firstname" value="First name:" />
									<p:inputText id="firstname" style="width:15em"
										value="#{startMBean.ticket.customer.firstName}" required="true"
										requiredMessage="We need your first name."
										label="First name">
										<f:validateLength minimum="2" />
									</p:inputText>
									
									<!-- <p:message for="firstname" /> -->


									<!-- Nachname -->
									<h:outputLabel for="lastname" value="Last name:" />
									<p:inputText id="lastname" value="#{startMBean.ticket.customer.lastName}"
										style="width:15em" required="true"
										requiredMessage="We need your last name"
										label="Last name">
										<f:validateLength minimum="2" />
									</p:inputText>
									
									<!-- <p:message for="lastname" /> -->

									<!-- Strasse -->
									<h:outputLabel for="street" value="Street" />
									<p:inputText id="street" value="#{startMBean.ticket.customer.address.street}"
										style="width:15em" required="true"
										requiredMessage="We need your street and house number"
										label="Street">
										<f:validateLength minimum="2" />
									</p:inputText>
									<!-- <p:message for="street" /> -->

									<!-- zip -->
									<h:outputLabel for="zip" value="ZIP" />
									<p:inputText id="zip" value="#{startMBean.ticket.customer.address.zip}"
										style="width:15em" required="true"
										requiredMessage="We need your zip code"
										label="ZIP">
										<f:validateLength minimum="2" />
									</p:inputText>
									<!-- <p:message for="zip" /> -->

									<!-- city -->
									<h:outputLabel for="city" value="City" />
									<p:inputText id="city" value="#{startMBean.ticket.customer.address.city}"
										style="width:15em" required="true"
										requiredMessage="We need your city"
										label="City">
										<f:validateLength minimum="2" />
									</p:inputText>
									<!-- <p:message for="city" /> -->

									<!-- country -->
									<h:outputLabel for="country" value="Country" />
									<p:inputText id="country" value="#{startMBean.ticket.customer.address.country}"
										style="width:15em" required="true"
										requiredMessage="We need your country"
										label="Country">
										<f:validateLength minimum="2" />
									</p:inputText>
									<!-- <p:message for="country" /> -->

									<!-- telno -->
									<h:outputLabel for="telno" value="Phone number:" />
									<p:inputText id="telno" value="#{startMBean.ticket.customer.telNo}"
										style="width:15em" required="true"
										requiredMessage="We need your phone number">
									</p:inputText>
									<!-- <p:message for="telno" /> -->

									<!-- Mail -->
									<h:outputLabel for="email" value="EMail address:" />
									<p:inputText id="email" value="#{startMBean.ticket.customer.mailAddress}"
										style="width:15em" required="true"
										requiredMessage="We need your Email address"
										validatorMessage="invalid Email address">
										<f:validateRegex
											pattern="([^.@]+)(\.[^.@]+)*@([^.@]+\.)+([^.@]+)" />
									</p:inputText>
									<!-- <p:message for="email" /> -->

									<!-- description -->
									<h:outputLabel for="description" value="Description:" />
									<p:inputTextarea id="description" value="#{startMBean.ticket.description}"
										style="width:30em" required="true"
										requiredMessage="We need a description">
									</p:inputTextarea>
									<!-- <p:message for="description" /> -->

								</p:panelGrid>
								<p></p>
								<p:commandButton id="submitData"
									update="panel1, :greeting, :toolbar:menuButton"
									value="create Ticket" icon="ui-icon-check"
									action="#{startMBean.saveTicket}" />
									
								<p:commandButton id="abort"
								value="Abort" icon="ui-icon-circle-close"
								action="#{startMBean.abortTicket}" immediate="true" />
								
							</h:form>
							<p></p>
							<br></br>
							<p></p>
							
						</div>
					</p:layoutUnit>
				</p:layout>
			</f:view>
		</ui:define>
	</ui:composition>
</h:body>
</html>